package com.co.notaweb.bussines;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.co.notaweb.entities.Grado;

/**
 * @author PC
 * @version 1.0
 * @created 13-nov-2011 12:14:25
 */
@Stateless
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public class GradoBussines implements IGradoBussinesLocal {

	@PersistenceContext(unitName = "notaweb")
	private EntityManager em;

	/**
	 * 
	 * @param grado
	 */
	public void create(Grado grado) {
		em.persist(grado);
	}

	/**
	 * 
	 * @param grado
	 */
	public void delete(Grado grado) {
		em.remove(grado);
	}

	/**
	 * 
	 * @param grado
	 */
	public void edit(Grado grado) {
		em.merge(grado);
	}

	/**
	 * 
	 * @param id
	 */
	public Grado find(long id) {
		return em.find(Grado.class, id);
	}

}